package com.createdevelopment.gaoyou.util;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

import org.apache.http.client.ClientProtocolException;

public class Test {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws ClientProtocolException 
	 */

	private void request() throws ClientProtocolException, IOException  {
		URL url=null;
		HttpURLConnection conn=null;
		url=new URL("http://www.baidu.com");
		conn=(HttpURLConnection)url.openConnection();
		conn.setConnectTimeout(6000);
		conn.setRequestMethod("GET");
		conn.setRequestProperty("accept", "*/*");
		conn.connect();
		

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
        try {
			new Test().request();
		} catch (ClientProtocolException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
